<?php

include(__DIR__ . '/ck/global.php');

$zoneId = empty($_GET['id']) ? 0 : (int)$_GET['id'];

if (empty($zoneId)) {
    exit('e1');
}

if (!$zoneRecord = Zone::getById($zoneId)) {
    exit('e2');
}

if (empty($zoneRecord['ids'])) {
    exit('e3');
}

$tmp = array_shift($zoneRecord['ids']);

if (empty($tmp['ad_id'])) {
    exit('e4');
}

if (!$adRecord = Ad::getById($tmp['ad_id'])) {
    exit('e5');
}

include 'res/share/index.html';
